package com.demo.java.crawl.controller;

import com.demo.java.crawl.entity.Entity;
import com.demo.java.crawl.processor.CSDNProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.Spider;
import us.codecraft.webmagic.model.OOSpider;

@RestController
public class CrawlController {

    @Autowired
    private CSDNProcessor csdnProcessor;

    @RequestMapping(value = "crawl/{url:.+}", method = {RequestMethod.GET})
    public <T extends Entity> T crawl(String url) {
        OOSpider.create(Site.me());
//        Spider.create(csdnProcessor)
        return null;
    }
}
